package com.hutra {
	
	/**
	 * ...
	 * @author hungconcon
	 */
	public class Secure {
		
		public function Secure() {
		
		}
		
		public function patternRecieved():Array {
			var codes:Array = new Array("AX", "BY", "CZ", "DN", "EV", "FP", "GO", "JR", "KT", "LS", "KS", "MX", "AY", "BZ", "CN", "DV", "EP", "FO", "GR", "JT", "GT", "JS", "LX", "MY", "AZ", "BN", "CV", "DP", "EO", "FR", "ER", "FT", "GS", "KX", "LY", "MZ", "AN", "BV", "CP", "DO");
			var decode:Array = new Array();
			for (var i:int = 0; i < 40; i++)
				decode[codes[i]] = i;
			var patternString:String = decodePattern('KSKTLSAX', decode);
			var patternInfo:String = patternString.split(";").reverse().join(",");
			return patternString.split(";");
		}
		
		public function decodePattern(patternString:String, decode:Array):String {
			var str:String = "";
			for (var i:int = 0; i < patternString.length; i = i + 2) {
				var twoBytes:String = patternString.slice(i, i + 2);
				var howMuch:int = decode[twoBytes] % 10 + 1;
				var pocketNum:int = Math.floor(decode[twoBytes] / 10) - 1;
				for (var j:int = 0; j < howMuch; ++j) {
					str = str + (";" + pocketNum);
				}
			}
			return (str.slice(1, str.length));
		}
	}

}